package net.zjitc.abstracts.grade;

/**
 * @Author admin
 * @Date 2019/3/20 11:42
 */
public class CollegeStudent extends Student {
    public CollegeStudent() {
    }

    /**
     * 初始化姓名、类型
     * @param name
     */
    public CollegeStudent(String name) {
        super(name);
        this.type="专科生";
    }

    @Override
    public void calculateGrade() {
        /* 计算出所有课程的平均分，
        80至100 优秀；70至80良好；60至70中等；50至60及格；50以下不及格*/
        double total=0;
        double average=0;
        for (int i = 0; i <courses.length ; i++) {
          total+=courses[i];
        }
        average=total/courseNo;
        if(average>=80 && average<=100){
           this.courseGrade="优秀";
        }else if(average>=70){
            courseGrade="良好";
        }else if(average>=60){
            courseGrade="中等";
        }else if(average>=50){
            courseGrade="及格";
        }else{
            courseGrade="不及格";
        }
    }
}
